﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CodeFirstDomain.IService;
using CodeFirstDomain.ModelContext;
using Framework.Services;
using Framework.UnitOfWork;
using CodeFirstDomain.Model;

namespace CodeFirstDomain.Service
{
    class QueryService : ApplicationService, IQueryService
    {
        public QueryService(IUnitOfWork uow) : base(uow){}

        public IQueryable<User> GetUsers()
        {
            var userRepository = GetRepository<User>();
            return userRepository.GetAll();
        }

        public IQueryable<MBlog> GetMBlogs(Guid userID)
        {
            var mblogRepository = GetRepository<MBlog>();
            return mblogRepository.GetAll(MBlog => MBlog.Author.ID == userID);
        }
    }
}
